Render an ID passΒΆ
For composition needs it is often required to render a special id pass. This can be done solely with the RenderGraph.
Let's create an Id pass with a red color for the sphere and a yellow for the plane.
- Add a standard Id AOV in Layer of the RenderPass.
Drill down into the previous NewRenderGraph.Create a Tags:plane node, two MaterialOverride nodes, two binop.union nodes andconnect them as in the graph below.- Select the MaterialOverride2 and MaterialOverride3 node and type 'Id' in the text box and choose Color in the combo box and click on the Add button of a properties view.
- Set the Id color for each node respectively to red and yellow.
- Render the image.
The sphere and the plane are now respectively rendered in red and yellow. Check in the Render view that the Id AOV contains the right colors.
This RenderGraph can be explained like this :
In the branch that selects the sphere/plane Primitive via the sphere/plane Tag there is a MaterialOverride node, which overrides the Id color to red/yellow, and in the shader of the RenderPass there is a RenderAttr node that has Id for its Attr value and is connected to the AOV Id input of the RenderLayer node. Then those two branches are merged together into a branch that is at its turn merged into the main branch.